\(\int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx\) [280]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 35 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=a A x+\frac {(A b+a B) \text {arctanh}(\sin (c+d x))}{d}+\frac {b B \tan (c+d x)}{d} \]

[Out]

a*A*x+(A*b+B*a)*arctanh(sin(d*x+c))/d+b*B*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3999, 3852, 8, 3855} \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\frac {(a B+A b) \text {arctanh}(\sin (c+d x))}{d}+a A x+\frac {b B \tan (c+d x)}{d} \]

[In]

Int[(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x]),x]

[Out]

a*A*x + ((A*b + a*B)*ArcTanh[Sin[c + d*x]])/d + (b*B*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3999

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> Simp[a*c*x, x]
 + (Dist[b*d, Int[Csc[e + f*x]^2, x], x] + Dist[b*c + a*d, Int[Csc[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e,
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rubi steps \begin{align*} \text {integral}& = a A x+(b B) \int \sec ^2(c+d x) \, dx+(A b+a B) \int \sec (c+d x) \, dx \\ & = a A x+\frac {(A b+a B) \text {arctanh}(\sin (c+d x))}{d}-\frac {(b B) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d} \\ & = a A x+\frac {(A b+a B) \text {arctanh}(\sin (c+d x))}{d}+\frac {b B \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.23 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=a A x+\frac {A b \text {arctanh}(\sin (c+d x))}{d}+\frac {a B \text {arctanh}(\sin (c+d x))}{d}+\frac {b B \tan (c+d x)}{d} \]

[In]

Integrate[(a + b*Sec[c + d*x])*(A + B*Sec[c + d*x]),x]

[Out]

a*A*x + (A*b*ArcTanh[Sin[c + d*x]])/d + (a*B*ArcTanh[Sin[c + d*x]])/d + (b*B*Tan[c + d*x])/d

Maple [A] (verified)

Time = 1.86 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.23

method result size
parts \(a A x +\frac {\left (A b +B a \right ) \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {b B \tan \left (d x +c \right )}{d}\) \(43\)
derivativedivides \(\frac {a A \left (d x +c \right )+B a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B b \tan \left (d x +c \right )}{d}\) \(57\)
default \(\frac {a A \left (d x +c \right )+B a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B b \tan \left (d x +c \right )}{d}\) \(57\)
parallelrisch \(\frac {-\cos \left (d x +c \right ) \left (A b +B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\cos \left (d x +c \right ) \left (A b +B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+a A x d \cos \left (d x +c \right )+B \sin \left (d x +c \right ) b}{d \cos \left (d x +c \right )}\) \(87\)
norman \(\frac {a A x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-a A x -\frac {2 B b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+\frac {\left (A b +B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {\left (A b +B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(102\)
risch \(a A x +\frac {2 i B b}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A b}{d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A b}{d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}\) \(105\)

[In]

int((a+b*sec(d*x+c))*(A+B*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

a*A*x+(A*b+B*a)/d*ln(sec(d*x+c)+tan(d*x+c))+b*B*tan(d*x+c)/d

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 85 vs. \(2 (35) = 70\).

Time = 0.28 (sec) , antiderivative size = 85, normalized size of antiderivative = 2.43 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\frac {2 \, A a d x \cos \left (d x + c\right ) + {\left (B a + A b\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (B a + A b\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, B b \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

[In]

integrate((a+b*sec(d*x+c))*(A+B*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(2*A*a*d*x*cos(d*x + c) + (B*a + A*b)*cos(d*x + c)*log(sin(d*x + c) + 1) - (B*a + A*b)*cos(d*x + c)*log(-s
in(d*x + c) + 1) + 2*B*b*sin(d*x + c))/(d*cos(d*x + c))

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 71 vs. \(2 (32) = 64\).

Time = 4.19 (sec) , antiderivative size = 71, normalized size of antiderivative = 2.03 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\begin {cases} \frac {A a \left (c + d x\right ) + A b \log {\left (\tan {\left (c + d x \right )} + \sec {\left (c + d x \right )} \right )} + B a \log {\left (\tan {\left (c + d x \right )} + \sec {\left (c + d x \right )} \right )} + B b \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \sec {\left (c \right )}\right ) \left (a + b \sec {\left (c \right )}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*sec(d*x+c))*(A+B*sec(d*x+c)),x)

[Out]

Piecewise(((A*a*(c + d*x) + A*b*log(tan(c + d*x) + sec(c + d*x)) + B*a*log(tan(c + d*x) + sec(c + d*x)) + B*b*
tan(c + d*x))/d, Ne(d, 0)), (x*(A + B*sec(c))*(a + b*sec(c)), True))

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.60 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\frac {{\left (d x + c\right )} A a + B a \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + A b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + B b \tan \left (d x + c\right )}{d} \]

[In]

integrate((a+b*sec(d*x+c))*(A+B*sec(d*x+c)),x, algorithm="maxima")

[Out]

((d*x + c)*A*a + B*a*log(sec(d*x + c) + tan(d*x + c)) + A*b*log(sec(d*x + c) + tan(d*x + c)) + B*b*tan(d*x + c
))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (35) = 70\).

Time = 0.30 (sec) , antiderivative size = 84, normalized size of antiderivative = 2.40 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\frac {{\left (d x + c\right )} A a + {\left (B a + A b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (B a + A b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]

[In]

integrate((a+b*sec(d*x+c))*(A+B*sec(d*x+c)),x, algorithm="giac")

[Out]

((d*x + c)*A*a + (B*a + A*b)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - (B*a + A*b)*log(abs(tan(1/2*d*x + 1/2*c) - 1
)) - 2*B*b*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 - 1))/d

Mupad [B] (verification not implemented)

Time = 14.59 (sec) , antiderivative size = 114, normalized size of antiderivative = 3.26 \[ \int (a+b \sec (c+d x)) (A+B \sec (c+d x)) \, dx=\frac {2\,A\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {B\,b\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}-\frac {A\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}}{d}-\frac {B\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}}{d} \]

[In]

int((A + B/cos(c + d*x))*(a + b/cos(c + d*x)),x)

[Out]

(2*A*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (A*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*
2i)/d - (B*a*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*2i)/d + (B*b*sin(c + d*x))/(d*cos(c + d*x))